<%@ Page Language="C#" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="UserControls/RollUpReport.ascx" TagName="RollUpReport" TagPrefix="uc2" %>
<%@ Register Src="userControls/MTD_Sales.ascx" TagName="MTD_Sales" TagPrefix="uc1" %>
<%@ Register Src="userControls/Channels.ascx" TagName="Channels" TagPrefix="uc3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script src="../scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (RollUpReport1 != null)
        {
            RollUpReport1.TopLevel = Request.QueryString["ROLLUP_TYPE"];
            RollUpReport1.RollUpUnit = Request.QueryString["ROLLUP_ID"];
            RollUpReport1.RollupTitle = Request.QueryString["Title"].Trim().Split(':')[0];

            //MTD_Sales1.TopLevel = Request.QueryString["ROLLUP_TYPE"];
            //MTD_Sales1.RollUpUnit = Request.QueryString["ROLLUP_ID"];
            //MTD_Sales1.RollupTitle = Request.QueryString["Title"].Trim().Split(':')[0];

            //Channels1.TopLevel = Request.QueryString["ROLLUP_TYPE"];
            //Channels1.RollUpUnit = Request.QueryString["ROLLUP_ID"];
            //Channels1.RollupTitle = Request.QueryString["Title"].Trim().Split(':')[0];
            
            ////TracID_Summary1.TopLevel = Request.QueryString["ROLLUP_TYPE"];
            ////TracID_Summary1.RollUpUnit = Request.QueryString["ROLLUP_ID"];
            ////TracID_Summary1.RollupTitle = Request.QueryString["Title"].Trim().Split(':')[0];

            //RollUpReport1.ShowOptions = PageHeading1.ShowOptions;
        }
    }
</script>
<script type="text/javascript" language="javascript">


    $(document).ready(function () {
        if (parent.reports == null) {
            alert('Wait...')
            printpreview()

            //           var x = confirm("Close Document?")
            //           window.close()


        }

        function printpreview() {
            var OLECMDID = 7;
            /* OLECMDID values: * 6 - print * 7 - print preview * 1 - open window * 4 - Save As */
            var PROMPT = 2; // 2 DONTPROMPTUSER 
            var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';

            this.document.body.insertAdjacentHTML('beforeEnd', WebBrowser);

            WebBrowser1.ExecWB(OLECMDID, PROMPT);
            WebBrowser1.outerHTML = "";
        }

        function dud() { null; }

    });


    function setCookie(c_name, value, expiredays) {
        var exdate = new Date();
        exdate.setDate(exdate.getDate() + expiredays);
        document.cookie = c_name + "=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toUTCString());
    }

    function getCookie(c_name) {
        if (document.cookie.length > 0) {
            c_start = document.cookie.indexOf(c_name + "=");
            if (c_start != -1) {
                c_start = c_start + c_name.length + 1;
                c_end = document.cookie.indexOf(";", c_start);
                if (c_end == -1) c_end = document.cookie.length;
                return unescape(document.cookie.substring(c_start, c_end));
            }
        }
        return "";
    }
    function saveScroll() {
        var x = document.documentElement.scrollLeft
        var y = document.documentElement.scrollTop
        setCookie("xy", x + "_" + y, 1)
    }

    function loadScroll() {
        var xy = getCookie("xy");
        if (!xy) return;
        var ar = xy.split("_");
        if (ar.length == 2) {
            document.documentElement.scrollLeft = parseInt(ar[0]),
            document.documentElement.scrollTop = parseInt(ar[1]);
        }
    }

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <meta http-equiv="Page-Enter" content="progid:DXImageTransform.Microsoft.Fade(Duration=1.25)" />
    <meta http-equiv="Page-Exit" content="progid:DXImageTransform.Microsoft.Fade(Duration=1.25)" />
    <title></title>
    <link href="css/RollUp.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="Visifire2.js"></script>
    <%--    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>--%>
</head>
<body onload="loadScroll()" onunload="saveScroll()">
    <form id="form1" runat="server">
    <div style="display: none">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
    </div>
    <div style="position: relative; bottom: 10px">
        <uc2:RollUpReport ID="RollUpReport1" runat="server" />
      <%--   <uc1:MTD_Sales ID="MTD_Sales1" runat="server" />
       <uc3:Channels ID="Channels1" runat="server" />--%>
    </div>
    </form>
</body>
</html>
